﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "ExamStatus")]
    public class ExamStatusInfo : IDetach
    {
        public ExamStatusInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private int _eid = 0;
        private int _studentid = 0;
        private bool _iswarning = false;
        private int _status = 0;
        private bool _isEnforceSubmit = false;
        private int _commitTimes = 1;
        private DateTime _startTime = DateTime.Now;
        private EntityRef<StudentInfo> _studentInfo;

        [XmlIgnore]
        [ScriptIgnore]
        [System.Data.Linq.Mapping.Association(Storage = "_studentInfo", ThisKey = "StudentId", OtherKey = "Id")]
        public StudentInfo StudentInfo
        {
            get { return _studentInfo.Entity; }
            set { this._studentInfo.Entity = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int Eid
        {
            set { _eid = value; }
            get { return _eid; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int StudentId
        {
            set { _studentid = value; }
            get { return _studentid; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public bool IsWarning
        {
            set { _iswarning = value; }
            get { return _iswarning; }
        }
        /// <summary>
        /// 0正常考试1交卷
        /// </summary>
        [Column]
        public int Status
        {
            set { _status = value; }
            get { return _status; }
        }

        [Column]
        public bool IsEnforceSubmit
        {
            set { _isEnforceSubmit = value; }
            get { return _isEnforceSubmit; }
        }

        [Column]
        public int CommitTimes
        {
            set { _commitTimes = value; }
            get { return _commitTimes; }
        }
        [Column]
        public DateTime StartTime
        {
            set { _startTime = value; }
            get { return _startTime; }
        }

        #endregion Model

        public void Detach()
        {
            this._studentInfo = default(EntityRef<StudentInfo>);
        }
    }
}
